package com.xs.param;

public class Text1 {
    public static void main(String[] args) {
        int[] arr={10,20,3,5,15,4};
        int index=shuzhu(arr,4);
        System.out.println("你查询的数字的索引是："+index);
    }

    public static int shuzhu(int[] arr,int date){
        for (int i = 1;i<arr.length;i++){
            if (arr[i]==date){
                return i;//i从1开始，所以arr数组的索引就是i-1;
            }
        }
        return -1;
    }
}
